import defaultSetting from "../common/utils/defaultSetting";
import BasicLayout from "../layouts/BasicLayout/index.vue";
import BlankLayout from "../layouts/BlankLayout/index.vue";
import ExploreAi from "../layouts/ExploreAi/index.vue";
import ShotstackLayout from "../layouts/ShotstackLayout/index.vue";
import store from "@/store";
import components from "./components";
import utils from "../common/utils/utils";
import {
  ref
} from "vue";

const isWin =
  import.meta.env.ELECTRON;
/**
 * @description: 访问路径添加子应用前缀
 * @param {String}path
 * @return {*}
 */
const getPath = (path) => {
  let prefix = "";
  if (window.__POWERED_BY_QIANKUN__) {
    prefix = `/apps/${defaultSetting.name}`; // prefix内容为主应用的activeRule
  }
  path = prefix + path;
  return path;
};

const getRedirectPath = (to) => {
  console.log(to);
  const urlParams = utils.getUrlQuery(null, location.href);
  let source = "";
  if (urlParams.source) {
    if (urlParams.source.indexOf("#/") != -1) {
      let sourceArr = urlParams.source.split("#/");
      if (sourceArr.length > 1) {
        source = sourceArr[0];
      }
    }
  }
  if (source) {
    localStorage.setItem("USER_ACCESS_SOURCE", source);
    if (!localStorage.getItem("USER_ACCESS_SOURCE_INFO")) {
      localStorage.setItem(
        "USER_ACCESS_SOURCE_INFO",
        JSON.stringify({
          user_agent: navigator.userAgent,
          source_url: document.referrer,
        })
      );
    }
    window.location.href =
      location.origin + "/#/sceneModel/work" + location.search;
  } else {
    // 进入第一个子菜单
    const parentRoute = to.matched[0];
    let name = parentRoute.children[0].name;
    return {
      name
    };
  }
};

const routes = [
  // 基于BasicLayout布局的页面，不需要基础布局的可以不用嵌套路

  {
    name: "WorkAIIndex",
    path: "/workShotstack",
    component: components.WorkAIIndex,
    meta: {
      title: "首页",
      permission: ["admin"],
      hidden: true
    },
  },
  {
    name: "workGPT",
    path: getPath(""),
    component: BasicLayout,
    // redirect: (to) => getRedirectPath(to),
    redirect: "/workShotstack",
    children: [{
        name: "SceneModel",
        path: "sceneModel",
        meta: {
          title: "AI应用",
          permission: ["admin"],
          icon: "icon-moxing"
        },
        children: [{
            name: "WorkAI",
            path: "WorkAI",
            component: components.WorkAI,
            meta: {
              title: "官网首页",
              permission: ["admin"],
              icon: "icon-gongzuotai1",
              firstRouteAlias: "SceneModel",
            },
          },
          {
            name: "Work",
            path: "work",
            component: components.Work,
            meta: {
              title: "工作台",
              permission: ["admin"],
              icon: "icon-gongzuotai1",
              firstRouteAlias: "SceneModel",
            },
          },
          {
            name: "Collect",
            path: "collect",
            component: components.Collect,
            meta: {
              title: "我的收藏",
              permission: ["admin"],
              icon: "icon-a-bianzu2",
              firstRouteAlias: "SceneModel",
            },
          },
          {
            name: "ApplicationHome",
            path: "index",
            component: components.ApplicationHome,
            meta: {
              title: "全部应用",
              permission: ["admin"],
              firstRouteAlias: "SceneModel",
              icon: "icon-yingyong",
              hidden: true,
            },
          },
          {
            name: "Scene",
            path: "scene/:cateId",
            component: components.Scene,
            meta: {
              title: "场景",
              permission: ["admin"],
              hidden: true
            },
          },
        ],
      },

      {
        name: "Home",
        path: "/home",
        component: components.Home,
        redirect: (to) => {
          return {
            name: "Work",
          };
        },
        meta: {
          title: "首页",
          permission: ["admin"],
          icon: "icon-shouye",
          firstRouteAlias: "Home",
          hidden: true,
        },
      },
      {
        name: "ChatModel",
        path: "chatModel",
        meta: {
          title: "AI 聊天",
          permission: ["admin"],
          icon: "icon-huihualiang-xian",
        },
        children: [{
            name: "Chat",
            path: "chat",
            component: components.Chat,
            meta: {
              title: "AI聊天对话",
              permission: ["admin"],
              icon: "icon-duihua1",
              firstRouteAlias: "ChatModel",
            },
          },
          {
            name: "AppChat",
            path: "appChat/:appId",
            component: components.CompanyAppChat,
            meta: {
              title: "AI聊天对话",
              permission: ["admin"],
              icon: "icon-duihua",
              firstRouteAlias: "ChatModel",
              hidden: true,
            },
          },
          {
            name: "Create",
            path: "create",
            component: components.Create,
            meta: {
              title: "AI创作工具",
              permission: ["admin"],
              icon: "icon-wodechuangzuo",
              firstRouteAlias: "ChatModel",
            },
          },
          {
            name: "Tools",
            path: "tools",
            component: components.Tools,
            meta: {
              title: "AI工具箱",
              permission: ["admin"],
              icon: "icon-moxing",
              firstRouteAlias: "ChatModel",
            },
          },
          {
            name: "Plugin",
            path: "plugin/:cateId",
            component: components.Create,
            meta: {
              title: "AI创作工具",
              permission: ["admin"],
              icon: "icon-moxing",
              firstRouteAlias: "ChatModel",
              hidden: true,
            },
          },

          {
            name: "PromptsIndex",
            path: "prompts",
            component: components.PromptsIndex,
            meta: {
              title: "Prompt提示词",
              permission: ["admin"],
              icon: "icon-tishici",
            },
          },
          {
            name: "PromptsList",
            path: "promptsList",
            component: components.PromptsList,
            meta: {
              title: "提示词",
              permission: ["admin"],
              hidden: true,
              parentRouteAlias: "PromptsIndex",
            },
          },
          {
            name: "PromptDetail",
            path: "promptDetail",
            component: components.PromptDetail,
            meta: {
              title: "提示词",
              permission: ["admin"],
              hidden: true,
              parentRouteAlias: "PromptsIndex",
            },
          },
        ],
      },
      {
        name: "IndustryModel",
        path: "industryModel",
        component: BlankLayout,
        meta: {
          title: "AI 行业",
          permission: ["admin"],
          icon: "icon-moxing",
        },
        children: [{
            name: "IndustryHome",
            path: "index",
            component: components.IndustryHome,
            meta: {
              title: "全部行业",
              permission: ["admin"],
              icon: "icon-yingyong",
              firstRouteAlias: "IndustryModel",
            },
          },
          {
            name: "Industry",
            path: "industry/:cateId",
            component: components.Scene,
            meta: {
              title: "场景",
              permission: ["admin"],
              hidden: true
            },
          },
        ],
      },
      {
        name: "PaintModel",
        path: "paintModel",
        meta: {
          title: "AI 绘画",
          permission: ["admin"],
          icon: "icon-huihua",
          // hidden: true,
          firstRouteAlias: "PaintModel",
        },
        children: [{
            name: "PaintIndex",
            path: "paint",
            component: components.Paint,
            meta: {
              title: "首页",
              permission: ["admin"],
              icon: "icon-huihua",
              firstRouteAlias: "PaintModel",
              parentRouteAlias: "PaintIndex",
            },
          },
          {
            name: "myCreation",
            path: "myCreation",
            component: components.myCreation,
            meta: {
              title: "我的创作",
              permission: ["admin"],
              icon: "icon-tupian",
            },
            firstRouteAlias: "PaintModel",
            parentRouteAlias: "PaintIndex",
          },
          {
            name: "PaintDetail",
            path: "paintDetail",
            component: BlankLayout,
            meta: {
              title: "高级创作",
              permission: ["admin"],
              icon: "icon--_moxingyuce",
            },
            children: [{
              name: "Detail",
              path: "detail",
              component: components.Detail,
              meta: {
                title: "绘画详情",
                permission: ["admin"],
                hidden: true,
                firstRouteAlias: "Paint",
                parentRouteAlias: "PaintIndex",
              },
            }, ],
          },
          {
            name: "PaintTool",
            path: "paintTool",
            component: BlankLayout,
            meta: {
              title: "热门模型",
              permission: ["admin"],
              icon: "icon-moxing",
            },
            children: [{
              name: "Detail",
              path: "detail",
              component: components.Detail,
              meta: {
                title: "绘画详情",
                permission: ["admin"],
                hidden: true,
                firstRouteAlias: "Paint",
                parentRouteAlias: "PaintIndex",
              },
            }, ],
          },
          {
            name: "Classify",
            path: "classify",
            component: components.Classify,
            meta: {
              title: "分类页",
              permission: ["admin"],
              hidden: true,
              firstRouteAlias: "Paint",
              parentRouteAlias: "PaintIndex",
            },
          },
          {
            name: "Detail",
            path: "detail",
            component: components.Detail,
            meta: {
              title: "详情页",
              permission: ["admin"],
              hidden: true,
              firstRouteAlias: "Paint",
              parentRouteAlias: "PaintIndex",
            },
          },
        ],
      },

      {
        name: "Training",
        path: "training",
        component: BlankLayout,
        meta: {
          title: "AI 训练",
          permission: ["admin"],
          icon: "icon--_moxingxunlian",
        },
        children: [{
            name: "TrainingHome",
            path: "index",
            component: components.TrainingHome,
            meta: {
              title: "AI 训练",
              permission: ["admin"],
              hidden: true,
              firstRouteAlias: "Training",
            },
          },
          {
            name: "TrainingSetting",
            path: "setting",
            component: components.TrainingSetting,
            meta: {
              title: "AI 训练",
              permission: ["admin"],
              hidden: true,
              firstRouteAlias: "Training",
            },
            children: [{
                name: "TrainingInfo",
                path: "info",
                component: components.TrainingInfo,
                meta: {
                  title: "基本信息",
                  permission: ["admin"],
                  hidden: true,
                  firstRouteAlias: "Training",
                },
              },
              {
                name: "TrainingMembers",
                path: "members",
                component: components.TrainingMembers,
                meta: {
                  title: "成员管理",
                  permission: ["admin"],
                  hidden: true,
                },
              },

              {
                name: "TrainingKnowledgeBase",
                path: "knowledgeBase",
                component: components.KnowledgeBase,
                meta: {
                  title: "知识库",
                  permission: ["admin"],
                  hidden: true
                },
              },
              {
                name: "WikiData",
                path: "wikiData",
                component: components.WikiData,
                meta: {
                  title: "知识库",
                  permission: ["admin"],
                  hidden: true,
                  parentRouteAlias: "WikiList",
                },
              },
              {
                name: "TrainingAppList",
                path: "appList",
                component: components.CompanyAppList,
                meta: {
                  title: "企业专属AI ",
                  permission: ["admin"],
                  hidden: true,
                  parentRouteAlias: "TrainingSetting",
                },
              },
              {
                name: "TrainingAppDetail",
                path: "appDetail",
                component: components.CompanyAppDetail,
                meta: {
                  title: "机器人详情",
                  hidden: true,
                  parentRouteAlias: "TrainingAppList",
                },
              },
            ],
          },
        ],
      },
      {
        name: "Order",
        path: "order",
        component: components.Order,
        meta: {
          title: "订单管理",
          hidden: true
        },
      },
      {
        name: "Vip",
        path: "vip",
        component: components.Vip,
        meta: {
          title: "会员中心",
          hidden: true
        },
      },
      {
        name: "ActivateMembership",
        path: "activateMembership",
        component: components.ActivateMembership,
        meta: {
          title: "会员开通",
          hidden: true
        },
      },
      {
        name: "TeamSetting",
        path: "teamSetting",
        component: components.TeamSetting,
        meta: {
          title: "团队管理",
          hidden: true
        },
      },
      {
        name: "UserSetting",
        path: "userSetting",
        component: components.UserSetting,
        meta: {
          title: "账号设置",
          hidden: true
        },
      },

      {
        name: "CreateCenter",
        path: "createCenter",
        component: components.CreateCenter,
        meta: {
          title: "创作中心",
          hidden: true
        },
      },
    ],
  },
  {
    name: "TemplateEditor",
    path: "/templateEditor",
    component: components.TemplateEditor,
    meta: {
      title: "使用模板",
      hidden: true,
    },
  },
  {
    name: "ExploreAi",
    path: "/exploreAi",
    component: ExploreAi,
    meta: {
      title: "AI绘画使用指南",
      hidden: true
    },
  },
  {
    name: "mixedCutCreat",
    path: "/mixedCutCreat",
    component: components.MixedCutCreat,
    meta: {
      title: "视频混剪",
      hidden: true
    },
  },
  // 新图文剪辑
  {
    name: "GraphicTextCut",
    path: "/GraphicTextCut",
    component: components.GraphicTextCut,
    meta: {
      title: "图文剪辑",
      hidden: true
    },
  },
  // 新图文剪辑 -- 合成预览
  {
    name: "GraphicTextCutPreview",
    path: "/GraphicTextCutPreview",
    component: components.GraphicTextCutPreview,
    meta: {
      title: "合成预览",
      hidden: true
    },
  },
  {
    name: "ScriptSquare",
    path: "/ScriptSquare",
    component: components.ScriptSquare,
    meta: {
      title: "脚本剪辑",
      hidden: true,
    },
  },
  {
    name: "templateScriptSquare",
    path: "/templateScriptSquare",
    component: components.templateScriptSquare,
    meta: {
      title: "",
      hidden: true,
    },
  },
  {
    name: "templateScriptCopy",
    path: "/templateScriptCopy",
    component: components.templateScriptCopy,
    meta: {
      title: "",
      hidden: true,
    },
  },
  {
    name: "MixedCutPreview",
    path: "/MixedCutPreview",
    component: components.MixedCutPreview,
    meta: {
      title: "混剪预览",
      hidden: true
    },
  },
  {
    name: "EditingCenter",
    path: "/editingCenter",
    component: components.EditingCenter,
    meta: {
      title: "剪辑中心",
      hidden: true
    },
  },
  {
    name: "LoginPage",
    path: "/loginPage",
    component: components.loginPage,
    meta: {
      title: "登录",
      hidden: true
    },
  },
  {
    name: "EditingCenterPreview",
    path: "/editingCenterPreview",
    component: components.EditingCenterPreview,
    meta: {
      title: "剪辑中心预览",
      hidden: true
    },
  },
  {
    name: "workShotstack",
    path: getPath("/workShotstack"),
    component: ShotstackLayout,
    redirect: (to) => getRedirectPath(to),
    children: [{
        name: "Home",
        path: "home",
        component: components.StartWork,
        meta: {
          title: "工作台",
          icon: "icon-a-gongzuotai1",
          permission: ["admin"],
        },
      },
      {
        name: "Datacenter",
        path: "datacenter",
        component: components.Datacenter,
        meta: {
          title: "数据中心",
          permission: ["admin"],
          icon: "icon-shujuzonglan1",
          hidden: true,
        },
      },
      {
        name: "NoticeList",
        path: "notice",
        component: components.NoticeList,
        meta: {
          title: "公告列表",
          permission: ["admin"],
          hidden: true,
        },
      },
      {
        name: "AiCreate",
        path: "aiCreate",
        component: components.AiCreate,
        meta: {
          title: "AI创作工具",
          permission: ["admin"],
          hidden: true,
        },
      },
      {
        name: "Info",
        path: "info",
        component: components.Info,
        meta: {
          title: "主体信息",
          permission: ["admin"],
          hidden: true,
        },
      },
      {
        name: "Download",
        path: "download",
        component: components.Download,
        meta: {
          title: "下载中心",
          permission: ["admin"],
          hidden: true,
        },
      },
      {
        name: "Userinfo",
        path: "userinfo",
        component: components.Userinfo,
        meta: {
          title: "个人信息",
          permission: ["admin"],
          hidden: true,
        },
      },
      {
        name: "ChangePassword",
        path: "changePassword",
        component: components.ChangePassword,
        meta: {
          title: "修改密码",
          permission: ["admin"],
          hidden: true,
        },
      },
      {
        name: "LearningCenter",
        path: "learningCenter",
        component: components.LearningCenter,
        meta: {
          title: "学习中心",
          permission: ["admin"],
          hidden: true,
        },
      },
      {
        name: "CreationCenter",
        path: "creationCenter",
        meta: {
          title: "视频创作",
          permission: ["admin"],
          icon: "icon-chuangzuozhongxinB",
        },
        children: [{
            name: "MixedCutIntroduction",
            path: "MixedCutIntroduction",
            component: components.MixedCutIntroduction,
            meta: {
              title: "视频混剪",
              permission: ["admin"],
              icon: "icon-zhineng",
            },
          },
          // 图文剪辑列表入口
          {
            name: "GraphicTextCutList",
            path: "GraphicTextCutList",
            component: components.GraphicTextCutList,
            meta: {
              title: "图文剪辑",
              permission: ["admin"],
              icon: "icon-jianji",
              // hidden: true, 
            },
          },
          // 一键成片
          {
            name: "OneClickClip",
            path: "OneClickClip",
            component: components.OneClickClip,
            meta: {
              title: "一键成片",
              permission: ["admin"],
              icon: "icon-jiaoben",
            },
          },
          {
            name: "MixedCutIntroductionDetail",
            path: "MixedCutIntroductionDetail",
            component: components.MixedCutIntroductionDetail,
            meta: {
              title: "剪辑信息",
              permission: ["admin"],
              icon: "icon-zhineng",
              hidden: true,
            },
          },
          {
            name: "ScriptingTool",
            path: "ScriptingTool",
            component: components.ScriptingTool,
            meta: {
              title: "脚本剪辑",
              permission: ["admin"],
              icon: "icon-zhinengjiaobengongju",
            },
          },
          {
            // name: "FormworkSquareContent",
            // path: "FormworkSquareContent",
            // component: components.FormworkSquareContent,
            name: "PictureCreatVideo",
            path: "PictureCreatVideo",
            component: components.PictureCreatVideo,
            meta: {
              title: "图生视频",
              permission: ["admin"],
              icon: "icon-tushengshipin_xian",
            },
          },
          {
            name: "AddVideoIntelligentSplit",
            path: "AddVideoIntelligentSplit",
            component: components.AddVideoIntelligentSplit,
            meta: {
              title: "视频拆分",
              permission: ["admin"],
              icon: "icon-chaifen",
            },
          },

          {
            name: "CreativityTools",
            path: "creativityTools",
            component: components.CreativityTools,
            meta: {
              title: "创意工具",
              permission: ["admin"],
              icon: "icon-gongju",
            },
          },
          {
            name: "TextToSpeech",
            path: "textToSpeech",
            component: components.TextToSpeech,
            meta: {
              title: "文字转语音",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "AiWriting",
            path: "aiWriting",
            component: components.AiWriting,
            meta: {
              title: "AI创作",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "VideoIntelligentSplitList",
            path: "videoIntelligentSplitList",
            component: components.VideoIntelligentSplitList,
            meta: {
              title: "视频智能拆分列表",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoSplit",
            path: "VideoSplit",
            component: components.VideoSplit,
            meta: {
              title: "视频智能拆分详情",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoToTextList",
            path: "videoToTextList",
            component: components.VideoToTextList,
            meta: {
              title: "提取视频文字",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "AddVideoToText",
            path: "addVideoToText",
            component: components.AddVideoToText,
            meta: {
              title: "新建提取任务",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "ScriptLibraryList",
            path: "scriptLibraryList",
            component: components.ScriptLibraryList,
            meta: {
              title: "脚本库",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "Synthesis",
            path: "synthesis",
            component: components.Synthesis,
            meta: {
              title: "成片合成",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "ClipDetail",
            path: "clipDetail",
            component: components.ClipDetail,
            meta: {
              title: "剪辑详情",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "VideoExtractionIndex",
            path: "videoExtractionIndex",
            component: components.VideoExtractionIndex,
            meta: {
              title: "视频提取",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoExtractionList",
            path: "videoExtractionList",
            component: components.VideoExtractionList,
            meta: {
              title: "视频提取记录",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoExtractAudioIndex",
            path: "videoExtractAudioIndex",
            component: components.VideoExtractAudioIndex,
            meta: {
              title: "视频提取音频",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoExtractAudioList",
            path: "videoExtractAudioList",
            component: components.VideoExtractAudioList,
            meta: {
              title: "视频提取音频记录",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoCroppingIndex",
            path: "videoCroppingIndex",
            component: components.VideoCroppingIndex,
            meta: {
              title: "视频裁剪",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoCroppingList",
            path: "videoCroppingList",
            component: components.VideoCroppingList,
            meta: {
              title: "视频裁剪记录",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: 'VideoRemoveAudioIndex',
            path: 'videoRemoveAudioIndex',
            component: components.VideoRemoveAudioIndex,
            meta: {
              title: '视频去除音频',
              permission: ['admin'],
              hidden: true
            }
          },
          {
            name: 'VideoRemoveAudioList',
            path: 'videoRemoveAudioList',
            component: components.VideoRemoveAudioList,
            meta: {
              title: '视频去除音频记录',
              permission: ['admin'],
              hidden: true
            }
          },
          {
            name: "VideoRemoveSubtitlesIndex",
            path: "videoRemoveSubtitlesIndex",
            component: components.VideoRemoveSubtitlesIndex,
            meta: {
              title: "视频擦除字幕",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoRemoveSubtitlesList",
            path: "videoRemoveSubtitlesList",
            component: components.VideoRemoveSubtitlesList,
            meta: {
              title: "视频擦除字幕记录",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoRemoveSignIndex",
            path: "videoRemoveSignIndex",
            component: components.VideoRemoveSignIndex,
            meta: {
              title: "视频擦除标志",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoRemoveSignList",
            path: "videoRemoveSignList",
            component: components.VideoRemoveSignList,
            meta: {
              title: "视频擦除标志记录",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoTranslateIndex",
            path: "videoTranslateIndex",
            component: components.VideoTranslateIndex,
            meta: {
              title: "视频翻译",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoTranslateList",
            path: "videoTranslateList",
            component: components.VideoTranslateList,
            meta: {
              title: "视频翻译记录",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoGenerateSubtitlesIndex",
            path: "videoGenerateSubtitlesIndex",
            component: components.VideoGenerateSubtitlesIndex,
            meta: {
              title: "视频生成字幕",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "VideoGenerateSubtitlesList",
            path: "videoGenerateSubtitlesList",
            component: components.VideoGenerateSubtitlesList,
            meta: {
              title: "视频生成字幕记录",
              permission: ["admin"],
              hidden: true,
            },
          }
        ],
      },
      {
        name: "digitalHuman",
        path: "digitalHuman",
        meta: {
          title: "数字人分身",
          permission: ["admin"],
          icon: "icon-sucaizhongxin",
        },
        children: [{
            name: "AIdigitalHuman",
            path: "AIdigitalHuman",
            component: components.AIdigitalHuman,
            meta: {
              title: "数字人形象",
              permission: ["admin"],
              icon: "icon-shuziren1",
            },
          },
          {
            name: "SoundCloning",
            path: "SoundCloning",
            component: components.SoundCloning,
            meta: {
              title: "声音克隆",
              permission: ["admin"],
              icon: "icon-huatong",
            },
          },
          {
            name: "AIdigitalHumanCreatVideo",
            path: "AIdigitalHumanCreatVideo",
            component: components.AIdigitalHumanCreatVideo,
            meta: {
              title: "视频生成",
              permission: ["admin"],
              icon: "icon-tongyongsucai",
            },
          },
          {
            name: "AIdigitalHumanMassProduction",
            path: "AIdigitalHumanMassProduction",
            component: components.AIdigitalHumanMassProduction,
            meta: {
              title: "批量生成",
              permission: ["admin"],
              icon: "icon-yewu_qita_piliangshengcheng1",
            },
          },

          // {
          //   name: "ShopList",
          //   path: "shopList",
          //   component: components.ShopList,
          //   meta: {
          //     title: "项目库",
          //     permission: ["admin"],
          //     icon: "icon-ziyuan",
          //     hidden: true,
          //   },
          // },
        ],
      },
      {
        name: "OperationCenter",
        path: "operationCenter",
        meta: {
          title: "文案创作",
          permission: ["admin"],
          icon: "",
        },
        children: [{
            name: "Textlibrary",
            path: "Textlibrary",
            component: components.Textlibrary,
            meta: {
              title: "我的文案",
              permission: ["admin"],
              icon: "icon-bendiwenanku",
            },
          },
          {
            name: "TextImitation",
            path: "TextImitation",
            component: components.TextImitation,
            meta: {
              title: "文案仿写",
              permission: ["admin"],
              name: "TextImitation",
              icon: "icon-wenan3",
            },
          },
          {
            name: "AISceneCenter",
            path: "AIsceneCenter",
            component: components.SceneCenter,
            meta: {
              title: "创作工具",
              permission: ["admin"],
              icon: "icon-kaishichuangzuo",
            },
          },
          {
            name: "HotTextScript",
            path: "HotTextScript",
            component: components.HotTextScript,
            meta: {
              title: "爆款文案库",
              permission: ["admin"],
              icon: "icon-remensucai",
            },
          },

          {
            name: "KeywordThesaurus",
            path: "KeywordThesaurus",
            component: components.KeywordThesaurus,
            meta: {
              title: "关键词库",
              permission: ["admin"],
              name: "KeywordSettings",
              icon: "icon-seo-marketing-business-mobile-pay-creditcard",
            },
          },
          {
            name: "RiskWordSettings",
            path: "RiskWordSettings",
            component: components.RiskWordSettings,
            meta: {
              title: "风险词管理",
              permission: ["admin"],
              name: "RiskWordSettings",
              icon: "icon-minganciliebiao",
            },
          },
          {
            name: "TextImitationList",
            path: "TextImitationList",
            component: components.TextImitationList,
            meta: {
              title: "文案仿写",
              permission: ["admin"],
              name: "TextImitationList",
              hidden: true,
            },
          },
          {
            name: "CopywritingFissionDetail",
            path: "CopywritingFissionDetail",
            component: components.CopywritingFissionDetail,
            meta: {
              title: "文案详情",
              permission: ["admin"],
              name: "CopywritingFissionDetail",
              hidden: true,
            },
          },
        ],
      },
      {
        name: "AICreation",
        path: "aiCreation",
        meta: {
          title: "AI创作",
          permission: ["admin"],
          icon: "icon-AIchuangzuoa",
          hidden: true,
        },
        children: [{
            name: "SceneCenter",
            path: "sceneCenter",
            component: components.SceneCenter,
            meta: {
              title: "场景创作",
              permission: ["admin"],
              icon: "icon-kaishichuangzuo",
            },
          },
          {
            name: "SceneCreation",
            path: "sceneCreation",
            component: components.SceneCreation,
            meta: {
              title: "场景",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "SceneClassify",
            path: "sceneClassify",
            component: components.SceneClassify,
            meta: {
              title: "场景分类",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "SceneChat",
            path: "sceneChat",
            component: components.Chat,
            meta: {
              title: "场景聊天",
              permission: ["admin"],
              hidden: true
            },
          },
          // {
          //   name: "FreedomConversation",
          //   path: "freedomConversation",
          //   component: components.Chat,
          //   meta: {
          //     title: "自由对话",
          //     permission: ["admin"],
          //     icon: "icon-duihua",
          //   },
          // },
          // {
          //   name: "AiDraw",
          //   path: "aiDraw",
          //   component: components.AiDraw,
          //   meta: {
          //     title: "AI作图",
          //     permission: ["admin"],
          //     icon: "icon-AIzuotuX2M",
          //   },
          // },
          // {
          //   name: "myCreation",
          //   path: "myCreation",
          //   component: components.myCreation,
          //   meta: {
          //     title: "我的创作",
          //     permission: ["admin"],
          //     icon: "icon-wodechuangzuo",
          //   },
          // },
          {
            name: "DrawDetail",
            path: "drawDetail",
            component: components.DrawDetail,
            meta: {
              title: "作图详情",
              permission: ["admin"],
              hidden: true,
              parentRouteName: "AiDraw",
            },
          },
        ],
      },
      {
        name: "MaterialCenter",
        path: "materialCenter",
        meta: {
          title: "创意素材",
          permission: ["admin"],
          icon: "icon-sucaizhongxin",
        },
        children: [{
            name: "TemplateList",
            path: "TemplateList",
            component: components.TemplateList,
            meta: {
              title: "模板广场",
              permission: ["admin"],
              icon: "icon-moban",
            },
          },
          {
            name: "ShopList",
            path: "shopList",
            component: components.ShopList,
            meta: {
              title: "项目库",
              permission: ["admin"],
              icon: "icon-ziyuan",
              hidden: true,
            },
          },
          {
            name: "PoiList",
            path: "PoiList",
            component: components.PoiList,
            meta: {
              title: "Poi列表",
              permission: ["admin"],
              icon: "icon-ziyuan",
              hidden: true,
            },
          },
          {
            name: "MaterialList",
            path: "materialList",
            component: components.MaterialList,
            meta: {
              title: "素材库",
              permission: ["admin"],
              icon: "icon-sucaizhongxin",
            },
          },

          {
            name: "RecycleBin",
            path: "recycleBin",
            component: components.RecycleBin,
            meta: {
              title: "回收站",
              permission: ["admin"],
              name: "ComposeMaterial",
              icon: "icon-delet",
            },
          },
        ],
      },

      {
        name: "MatrixMarketing",
        path: "matrixMarketing",
        meta: {
          title: "发布管理",
          permission: ["admin"],
          icon: "icon-juzhenyingxiao1",
        },
        children: [{
            name: "ComposeMaterial",
            path: "composeMaterial",
            component: components.ComposeMaterial,
            meta: {
              title: "剪辑成片",
              permission: ["admin"],
              name: "ComposeMaterial",
              icon: "icon-cz_jl",
            },
          },
          {
            name: "ReleaseList",
            path: "ReleaseList",
            component: components.ReleaseList,
            meta: {
              title: "智能发布",
              permission: ["admin"],
              icon: "icon-fb_jl",
              // icon: "icon-fb_sp",
            },
          },
          {
            name: "IpManage",
            path: "ipManage",
            component: components.IpManage,
            meta: {
              title: "矩阵管理",
              permission: ["admin"],
              icon: "icon-fenfa",
            },
          },

          {
            name: "AccountGroupList",
            path: "accountGroupList",
            component: components.AccountGroupList,
            meta: {
              title: "分组管理",
              permission: ["admin"],
              hidden: true
            },
          },

          {
            name: "QrRelease",
            path: "qrRelease",
            component: components.QrRelease,
            meta: {
              title: "发布成片",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "AutoRelease",
            path: "AutoRelease",
            component: components.QrRelease,
            meta: {
              title: "成片发布",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "ReleaseDetail",
            path: "releaseDetail",
            component: components.ReleaseDetail,
            meta: {
              title: "发布详情",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "BurstShop",
            path: "BurstShop",
            component: components.BurstShop,
            meta: {
              title: "爆店码",
              permission: ["admin"],
              icon: "icon-iconfontscan",
              // hidden: true,
            },
          },
          {
            name: "BurstShopDetail",
            path: "BurstShopDetail",
            component: components.BurstShopDetail,
            meta: {
              title: "添加爆店码",
              permission: ["admin"],
              icon: "icon-douyinkapian",
              hidden: true,
            },
          },
          {
            name: "BurstShopDetails",
            path: "BurstShopDetails",
            component: components.BurstShopDetails,
            meta: {
              title: "爆店码明细",
              permission: ["admin"],
              icon: "icon-douyinkapian",
              hidden: true,
            },
          },
        ],
      },

      {
        name: "CommentMessage",
        path: "reply",
        meta: {
          title: "运营触客",
          permission: ["admin"],
          icon: "icon-fenfa",
        },
        children: [

          {
            name: "CommentMessageConnect",
            path: "connect",
            component: components.PlatformCommentMessageConnect,
            meta: {
              title: "评论私信",
              permission: ["admin"],
              icon: "icon-sixin",
            },
          },
          {
            name: "CommentMessageAutomationList",
            path: "automation/list",
            component: components.PlatformCommentMessageConnect,
            meta: {
              title: "自动回复",
              permission: ["admin"],
              icon: "icon-zidonghuifu1",
            },
          },
          {
            name: "CommentMessageCustomerList",
            path: "customer/customer-list",
            component: components.PlatformCommentMessageConnect,
            meta: {
              title: "留资客户",
              permission: ["admin"],
              icon: "icon-kehu",
            },
          },
          {
            name: "CommentMessageSettingAuthCenter",
            path: "setting/auth-center",
            component: components.PlatformCommentMessageConnect,
            meta: {
              title: "账号授权",
              permission: ["admin"],
              icon: "icon-zhanghaoshouquan",
            },
          },

          {
            name: "TiktoktoWechat",
            path: "tiktoktoWechat",
            component: components.TiktoktoWechat,
            meta: {
              title: "引流工具",
              permission: ["admin"],
              icon: "icon-douyinkapian",
            },
          },

          {
            name: "Creatingdrainagetool",
            path: "creatingdrainagetool",
            component: components.Creatingdrainagetool,
            meta: {
              title: "新建抖转微",
              permission: ["admin"],
              hidden: true,
            },
          },
          {
            name: "CreatCart",
            path: "CreatCart",
            component: components.CreatCart,
            meta: {
              title: "新建卡片",
              permission: ["admin"],
              hidden: true,
            },
          },
        ],
      },
      // 微信管理--新增
      {
        name: "WechatMarketing",
        path: "wechatMarketing",
        meta: {
          title: "微信管理",
          icon: "icon-juzhenyingxiao1",
          permission: ["admin"],
        },
        children: [{
          name: "WechatComposeMaterial",
          path: "wechatcomposeMaterial",
          permission: ["admin"],
          component: components.WechatComposeMaterial,
          meta: {
            title: "账号管理",
            permission: ["admin"],
            name: "WechatComposeMaterial",
            icon: "icon-fenfa",
          },
        },
      {
          name: "WechatReleaseList",
          path: "wechatReleaseList",
          permission: ["admin"],
          component: components.WechatReleaseList,
          meta: {
            title: "智能发布",
            permission: ["admin"],
            name: "WechatReleaseList",
            icon: "icon-fb_jl",
          },
        },
        {
            name: "WechatAutoRelease",
            path: "wechatAutoRelease",
            component: components.WechatQrRelease,
            meta: {
              title: "成片发布",
              permission: ["admin"],
              hidden: true
            },
          },
      ],
      },

      {
        name: "PersonalCenter",
        path: "personalCenter",
        meta: {
          title: "个人中心",
          permission: ["admin"],
          icon: "icon-gerenzhongxin1",
        },
        children: [{
            name: "Index",
            path: "index",
            component: components.Index,
            meta: {
              title: "员工管理",
              permission: ["admin"],
              icon: "icon-yuangong",
            },
          },
          {
            name: "BusinessRecord",
            path: "businessRecord",
            component: components.BusinessRecord,
            meta: {
              title: "账户管理",
              permission: ["admin"],
              icon: "icon-zhanghu",
            },
          },
          {
            name: "PromotionLink",
            path: "promotionLink",
            component: components.PromotionLink,
            meta: {
              title: "邀请用户",
              permission: ["admin"],
              icon: "icon-yaoqing",
            },
          },
          {
            name: "VoucherCenter",
            path: "voucherCenter",
            component: components.VoucherCenter,
            meta: {
              title: "充值中心",
              permission: ["admin"],
              hidden: true
            },
          },
          {
            name: "InviteNewUsers",
            path: "inviteNewUsers",
            component: components.InviteNewUsers,
            meta: {
              title: "推广链接",
              permission: ["admin"],
              hidden: true
            },
          },
        ],
      },
      {
        name: "MemberBenefits",
        path: "memberBenefits",
        component: components.MemberBenefits,
        meta: {
          title: "会员权益",
          hidden: true
        },
      },
      {
        name: "TagManage",
        path: "tagManage",
        component: components.TagManage,
        meta: {
          title: "标签管理",
          hidden: true
        },
      },
      {
        name: "ItemTag",
        path: "itemTag",
        component: components.ItemTag,
        meta: {
          title: "项目标签列表",
          hidden: true
        },
      },
    ],
  },
  {
    name: "custom",
    path: getPath("/custom"),
    component: BlankLayout,
    redirect: (to) => getRedirectPath(to),
    children: [{
      name: "TextPreview",
      path: "textPreview",
      component: components.TextPreview,
      meta: {
        title: ""
      },
    }, ],
  },
  {
    name: "UseAgreement",
    path: "/UseAgreement",
    component: components.UseAgreement,
    meta: {
      title: "用户注册协议",
      hidden: true
    },
  },
  {
    name: "PrivacyAgreement",
    path: "/PrivacyAgreement",
    component: components.PrivacyAgreement,
    meta: {
      title: "用户隐私协议",
      hidden: true
    },
  },
];

export default routes;